/****************************************************************
 * Fulguro
 * Copyright (C) 2004 Christophe Clienti
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 ***************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __RT_CAPTURE_H
#define __RT_CAPTURE_H
  
#include <flgrCoreDll.h>
#include <flgrCoreErrors.h>
#include <flgrCoreTypes.h>
#include <flgrCoreData.h>
#include <linux/videodev.h>

  /*! 
   * Video capture device structure
   */  
  typedef struct {
    int fd;                                /*!< File descriptor*/
    unsigned char *framebuffer;            /*!< Mapped framebuffer*/
    struct video_capability vcap;          /*!< Video capabilities*/
    struct video_window vwin;              /*!< Window informations*/
    struct video_picture vpic;             /*!< Palette informations, Contrast, ...*/
    struct video_mmap vmmap;               /*!< Number of frame, ...*/
    struct video_mbuf vmbuf;               /*!< Size of mapped buffer*/
    struct video_channel vchan;            /*!< Video channels*/
  }FLGR_RtCapture2D;

  EXPORT_LIB FLGR_RtCapture2D *flgr2d_rtcapture_create(char *device);
  EXPORT_LIB void flgr2d_rtcapture_destroy(FLGR_RtCapture2D *camera);

  EXPORT_LIB unsigned short flgr2d_rtcapture_palette_from_string(char *palette);
  EXPORT_LIB char *flgr2d_rtcapture_get_palette(FLGR_RtCapture2D *viddev);  
  EXPORT_LIB FLGR_Ret flgr2d_rtcapture_set_palette(FLGR_RtCapture2D *viddev, char *palette);

  EXPORT_LIB char *flgr2d_rtcapture_identify_palette(FLGR_RtCapture2D *viddev);
  EXPORT_LIB FLGR_Ret flgr2d_rtcapture_gray_image(FLGR_Data2D *img, FLGR_RtCapture2D *camera);

  EXPORT_LIB FLGR_Ret flgr2d_rtcapture_get_window_size(FLGR_RtCapture2D *viddev, int *size_x, int *size_y);
  EXPORT_LIB FLGR_Ret flgr2d_rtcapture_set_window_size(FLGR_RtCapture2D *viddev, int size_x, int size_y);


#endif

#ifdef __cplusplus
}
#endif
